<template>
  <BasicModal
    :destroyOnClose="true"
    v-bind="$attrs"
    :draggable="true"
    :showCancelBtn="false"
    :showOkBtn="false"
    :title="modalData.title"
    width="1300px"
  >
    <!--  列表  -->
    <div class="full-width change-bg" v-for="group in modalData.data">
      <div class="line-title title-bg"> {{ group._id }} ({{ group.group_count }}) </div>

      <div class="line-flex">
        <div style="width: 20%" class="flex-item p-1" v-for="(item, index) in group.items">
          <Card hoverable class="cw-card">
            <div class="badge-ribbon"
            >{{ '   单量(' + item.order_num + ')' + '   单数(' + item.order_counts + ')' }}
            </div>
            <template #cover>
              <Image
                class="flex justify-center"
                lazyload
                width="auto"
                :height="200"
                fallback="http://wt-shop.com/storage/images/2024-03/header.jpg"
                :src="item.image"
              />
            </template>
            <Tooltip @click="goToKeepa({ domain_id: item.domain_id, asin: item.asin })">
              <template #title>{{ item.title }}</template>
              <CardMeta :title="item.title" :description="item.asin" />
            </Tooltip>
            <div class="mt-10px flex-wt">
              <div>
                <Tag v-if="item.group_name" color="green">{{ item.group_name }}</Tag>
              </div>
              <div
              ><span class="price">{{ item.buy_box_current }}</span
              ><span style="margin-left: 6px"
              >({{ translateCoinType(item.domain_id) }})
                </span></div
              >
            </div>
            <div v-if="item.sj_name" class="mt-6px">
              <Tag color="red">{{ item.sj_name }}</Tag>
            </div>
            <div v-else class="mt-6px">
              <Tag color="cyan">无数据名</Tag>
            </div>
            <Rate size="5" v-model:value="item.reviews_rating" disabled allow-half />
            <span class="star-rating"
            >{{ item.reviews_rating }}({{ item.reviews_review_count }})</span
            ><br />
          </Card>
        </div>
      </div>
    </div>
  </BasicModal>
</template>
<script lang="ts" setup>
import { translateCoinType } from '/@/utils/common'
import { BasicModal, useModalInner } from '/@/components/Modal'
import { ref } from '@vue/runtime-core'
import { Rate, Card, CardMeta, Avatar, Image, Tooltip, Tag } from 'ant-design-vue'

const props = defineProps({
  modalData: Object,
})

const emits = defineEmits(['keepaDetail'])

const goToKeepa = (item) => {
  emits('keepaDetail', item)
}
</script>
<style>
.ml-20 {
  margin-left: 10px;
  cursor: pointer;
}

.full-width {
  width: 100%;
  padding: 5px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  padding-top: 6px;
}

.line-title {
  margin-left: 5px;
  padding: 10px;
  border-radius: 4px;
  margin-top: 4px;
  font-size: 18px;
  font-weight: 600;
}

.line-flex {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
}

.flex-wt {
  display: flex;
  justify-content: space-between;
}

.mt-6px {
  margin-top: 6px;
}

.mt-10px {
  margin-top: 10px;
}

.cw-card {
  position: relative;
}

.badge-ribbon {
  position: absolute;
  right: 5px;
  top: 5px;
  background: #ee4f12;
  padding: 2px 5px;
  border-radius: 4px;
  color: white;
}

.full-page {
  width: 100%;
  height: 100%;
  padding-top: 15%;
}

.search-flex {
  display: flex;
}

.ant-image-img {
  max-height: 200px;
  width: auto !important;
}

.ant-image {
  display: flex;
  justify-content: center;
  padding: 2px 0;
}

.anticon-star {
  width: 12px;
}

.anticon-star svg {
  width: 16px;
}

.star-rating {
  vertical-align: text-bottom;
  margin-left: 8px;
  font-size: 13px;
  font-weight: 500;
}
.price {
  margin-left: 10px;
  font-size: 15px;
  font-weight: 500;
  color: red;
}
</style>
